package org.springblade.modules.repair.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springblade.core.tool.node.INode;

import java.util.ArrayList;
import java.util.List;

/**
 * @Date 15:30 2022/4/1
 * @Description {
 *   任务详情页模板分类所有根节点
 * }
 * @Author lsay
 **/
@Data
public class PlanDetailLocationTypeVO implements INode<PlanDetailLocationTypeVO> {

	/**
	 * 主键ID
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long id;

	/**
	 * 父节点ID
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long parentId;

	/**
	 * 分类id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long tltId;

	/**
	 * 工作项id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long contentId;

	/**
	 * 分类名称
	 */
	private String tltName;

	/**
	 * 工作项统计
	 */
	private Integer workItemCount;

	/**
	 * 子孙节点
	 */
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private List<PlanDetailLocationTypeVO> children;

	/**
	 * 是否有子孙节点
	 */
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private Boolean hasChildren;

	@Override
	public List<PlanDetailLocationTypeVO> getChildren() {
		if (this.children == null) {
			this.children = new ArrayList<>();
		}
		return this.children;
	}

}
